package com.budwk.app.sqfwV2.generator.shawenTown.pdf;

import com.budwk.app.sqfw.constants.CommonConstants;
import com.budwk.app.sqfwDoc.codeGeneratorV2.fileParam.PdfGenerateParam;
import com.budwk.app.sqfwDoc.codeGeneratorV2.generate.BasePdfGenerator;
import com.budwk.app.sqfwV2.component.ShawenTownComponent;
import com.budwk.app.sqfwV2.component.SignImageComponent;
import com.budwk.app.sqfwV2.dto.shawenTown.ShawenTownSafetyPdfDTO;
import com.budwk.app.sqfwV2.dto.shawenTown.ShawenTownSafetyProblemVo;
import com.budwk.app.util.StrUtil;

import java.util.Map;

/**
 * @author 沙文镇安全巡查表.1
 * @since 2024-03-11
 *
 * 沙文消防安全排查 ShawenTownSafety
 * 沙文镇安全巡查表.docx
 */
public class ShawenTownSafetyWordGenerator extends BasePdfGenerator{

    /**
     * 是否为小型经营场所  和  是否有电动自行车不等于是 时生成表格
     * @param pdfGenerateParam pdf生成参数
     * @return
     */
    @Override
    public boolean pdfCreateConditionCheck(PdfGenerateParam pdfGenerateParam) {
        return true;
    }

    @Override
    public String getTemplatePath(PdfGenerateParam pdfGenerateParam) {
        return "sqfwV2/shawenTown/shawenTownSafetyWord.docx";
    }

    @Override
    public void customerPopularPdfParam(Map<String, Object> paramMap, PdfGenerateParam pdfGenerateParam) {
        // 在这里对一些数据进行填充 进行复杂的业务代码逻辑
        ShawenTownSafetyPdfDTO pdfDTO = ShawenTownComponent.getShawenTownSafetyPdfDTO(pdfGenerateParam);
        buildParam(paramMap, pdfGenerateParam, pdfDTO);
        paramMap.put("comunity", StrUtil.formatZhiShu(pdfGenerateParam.getCreateUserCommonParam().getCounty()));
    }

    private void buildParam(Map<String, Object> paramMap, PdfGenerateParam pdfGenerateParam, ShawenTownSafetyPdfDTO pdfDTO) {
        SignImageComponent.signWord(paramMap, 5.0F, pdfDTO.getCheckedUnitLeader(),
                pdfGenerateParam.getCreateUserCommonParam().getCreateUserName(), "checkedUnitLeader", "checkedUnitLeaderStr");
        // 巡查时间
        ShawenTownComponent.formatFillDate(pdfDTO, paramMap);
    }
}









